<?php
/**
 * User: Paulo Fournier
 * Date: 03-07-2013
 * Type: class
 * User class to contain all information about the logged in user
 * Note that public attributes will be serialized and sent to the client browser
 */

class user {

    public $activation;     //Date NULL
    public $expiration;     //Date NULL
    public $authType;       //INT => Used to check the auth type [0 => normal, 1 => special]
    public $email;          //String
    public $emailStatus;    //INT => Used to verify if the user has validated the email address [0 => not validated, 1 => validated]
    public $groupAlias;     //String
    public $groupId;        //INT
    public $idChannel;      //INT
    public $idLogo;         //INT
    public $roleAlias;      //STRING
    public $roleId;         //INT
    public $subGroupAlias;  //STRING
    public $subGroupId;     //INT
    public $subGroupIdLogo; //INT
    public $userId;         //INT
    public $userName;       //INT

    //default regional settings
    public $lang = "pt";                    //String LEN(2)
    public $timezone = "Europe/Lisbon";     //String

    /***
     * Construct function to initialize the object
     * @param $attributes All attributes of the user
     */
    public function __construct($attributes){

        //save all values on the object root
        foreach($attributes as $key => $value){
            //set key/value
            $this->{$key} = $value;
        }
    }

}